const html = require('./index.html')
const createDom = require('../../until')
require('./index.css')

const tab = createDom(html)
let tabBtn    = document.getElementsByClassName('tab')

// 默认被加了高亮和显示盒子的坐标
module.exports = {
    tab,
    tabClick(tabFunc){
    let defaultIndex = 0;
    for(let i=0;i<tabBtn.length;i++){
        tabBtn[i].onclick = ()=>{
            tabBtn[defaultIndex].classList.remove('active')
            tabBtn[i].classList.add('active')
            tabFunc(i,defaultIndex)
            defaultIndex = i;
         }    
        }
    }
}
